Object-oriented programming of computers is gaining increasing popularity, in large part due to the great deal of flexibility which it offers with a relatively simple structure. Generally speaking, an object-oriented program comprises a collection of software entities known as objects, each of which is responsible for performing a particular task. Every object is characterized by associated properties, or data values, and one or more handlers that provide certain behavior or functionality. In operation, one object invokes the handlers of another object, to cause the second object to exhibit its associated behavior.
The behavior and properties of a given object can be extended to other objects through an inheritance structure. In such a structure, groups of associated objects can be organized in a hierarchical inheritance tree. In this type of arrangement, an object at a particular level of the hierarchy will inherit the properties and behavior of objects at higher levels from which it descends. Similarly, its property and behavior, including that inherited from higher-level objects, is passed on to lower-level objects that descend from it in the hierarchy.
The inheritance of object properties and handlers in an object-oriented program provides a number of desirable characteristics. Foremost among these is the reusability of software. Since an object at a lower level of the hierarchy inherits all of the behavior of objects at higher levels, the program code that provides particular behavior does not have to be rewritten for each object that is to exhibit that behavior. Consequently, fewer instances of that code exist in the program, and the debugging and testing of that portion of the code is therefore simplified. Another desirable aspect of inheritance is the consistency of interfaces that are provided. All objects which inherit from the same object or set of objects at a higher level of the hierarchy will exhibit the same properties and behavior, and thus present a consistent interface to the user.
Programming in an object-oriented system requires the programmer to build a structure for the set of objects, which defines how properties and handlers are to be inherited. Designing such a structure can be a complex and difficult task. Typically, the programmer doesn't begin the design of the code with the optimum structure in mind at the outset. Rather, as the program is developed, the designer typically discovers desirable variations to the original structure. For example, the designer may discover that a number of objects share a common attribute, and therefore should descend from a common parent to encapsulate that attribute. During development, the overall structure of the object-oriented program, i.e., its inheritance hierarchy, is typically modified over several iterations in such a fashion.
In the past, most program code for object-oriented systems has been text-based. More particularly, the relationships between objects in the hierarchy was described by means of a text file. From this text file, a database was built in working memory, e.g. RAM, to define the relationships during the run-time of the computer. Redesigning of the hierarchy in such systems involved changing the text scripts that defined the hierarchical relationships of the objects. These types of changes required the programmer to manually search through all of the files to find relevant portions of code and objects, and make the required changes. Typically, this was carried out by means of rather crude search and replace operations.
The redesigning of the code structure was even more complicated for object-oriented systems which support multiple inheritances. In these types of systems, an object can descend from, i.e. inherit properties and handlers from, more than one parent object at higher levels of the structure. The term “heterarchy” is used to describe the structure which exists in this type of system. A heterarchy differs from a conventional hierarchy by virtue of the fact that, in a hierarchy each object descends from one, and only one, parent object, whereas in a heterarchy each object can directly descend from more than one parent object. When an object descends from two or more parents, the parents are given a relative priority, or precedence, with respect to that object, in the event that some of their properties and/or handlers are mutually exclusive to one another. Because the interrelationships of objects in a heterarchical structure is much more complex, redesigning such a structure becomes significantly more difficult.
A particularly complex task in the redesign of the program structure is the addition and deletion of levels of the hierarchy or heterarchy. Typically, these kinds of changes involved writing new code to describe new objects in an added level or to remove references to objects in a deleted level, and then recompiling the program to incorporate the newly added code. Similarly, in the design of the program, if it became desirable to reorganize properties or handlers, for example to transfer a property from a descendant object to a newly added parent object, the associated code had to be rewritten and then recompiled.
It is desirable, therefore, to provide a system which permits a user to dynamically design and rearrange object structure, as well as design and rearrange the properties and handlers for an object after the structure has been redesigned, without the need to rewrite and recompile code.